import xlrd
import pymysql
#打开数据所在的工作簿，以及选择存有数据的工作表
book = xlrd.open_workbook('family.xls')
sheet = book.sheet_by_name("Sheet1")
#建立一个MySQL连接
conn = pymysql.connect(
        host='localhost',
        user='root',
        passwd='123456',
        db = 'aa',
        port=3306,
        charset='utf8'
        )
# 获得游标
cur = conn.cursor()

w_3 = "SELECT name FROM test WHERE NAME=(%s)"
values = ('')
cur.execute(w_3, values)
conn.commit()
if w_3:
    print(1)
else:
    print(0)

cur.close()
conn.commit()
conn.close()

print('OK')
